//
//  SiftDetailViewController.m
//  ZYZB
//
//  Created by ENERGY on 2018/7/2.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "SiftDetailViewController.h"
#import "JoinSiftViewController.h"
#import "SiftDetailTableViewCell.h"
#import "LendRecordViewController.h"
#define backButtonW 24/WIDTH_6_SCALE
#define backButtonH 30/WIDTH_6_SCALE
@interface SiftDetailViewController ()<UINavigationControllerDelegate, UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong)UITableView * tableView;
@property (nonatomic, strong)UIView * headerView;
@property (nonatomic, strong)UIButton * joinBtn;
@property (nonatomic, strong)UILabel * projectTitleLab;//福乐精选名
@property (nonatomic, strong)UILabel * bidNumLab;//投标人数
@property (nonatomic, strong)UILabel * lendRateContentLab;//出借率
@property (nonatomic, strong)UILabel * lastBidNumContentLab;//剩余投标数额
@property (nonatomic, strong)UILabel * bidLimitDayContentLab;//投标期限天数
@property (nonatomic, strong)UILabel * investmentAmountContentLab;//起投金额数
@property (nonatomic, strong)UILabel * objectAmountLab;//标的总额
@property (nonatomic, strong)UILabel * todayJoinDateLab;//今日加入日期
@property (nonatomic, strong)UILabel * nextDayDateLab;//次日计息日期
@property (nonatomic, strong)UILabel * lockDayDateLab;//锁定期满日期
@property (nonatomic, strong)UILabel * lastAccountDateLab;//最迟到账日期
@property (nonatomic, strong)UIButton * backBtn;//返回按钮
@property (nonatomic, strong)NSMutableArray * cellContentArr;//cell数据
@end

@implementation SiftDetailViewController(networking)
- (void)siftDetailData{
    [self showprogressHUD];
    NSString * timeStr = [self currentTimeStr];
    //str
    NSDictionary * dic = @{
                           @"userName":[UserModel sharedInstanced].mobile,
                           @"blessingsid":self.bidID,
                           @"t":timeStr
                           };
    //sign
    NSDictionary * signDic = @{
                               @"userName":[UserModel sharedInstanced].mobile,
                               @"blessingsid":self.bidID,
                               @"t":timeStr,
                               @"merchantNo":@"80d709a97af1b8ab"
                               };
    SortMD5Code * md5Code = [[SortMD5Code alloc] init];
    NSString * jsonStr = [md5Code getJsonWithStrDic:dic withSignDic:signDic];
    NSData *postData = [jsonStr dataUsingEncoding:NSUTF8StringEncoding];
    NSURL *url = [NSURL URLWithString:@"http://120.78.157.132:82/index.php/homepage/index?api=api1009"];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
    //设置请求方式
    request.HTTPMethod = @"POST";
    //设置请求参数
    request.HTTPBody = postData;
    [NSURLConnection sendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse * _Nullable response, NSData * _Nullable data, NSError * _Nullable connectionError) {
        [self hiddenProgressHUD];
        if (connectionError) {
            if (connectionError.code == -1001) {
                [self.view makeToast:@"请求网络超时，请稍后再试" duration:1 position:CSToastPositionCenter];
            }
        }else{
            NSDictionary *dictionary =[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];//data解析为dictionary
            if (!dictionary) {
                NSLog(@"数据缺失");
                return;
            }
            NSString * compareMD5Str = [md5Code encodeStringWithDictionary:dictionary];
            NSString * signResult = [dictionary objectForKey:@"sign"];//接到的json串sign字段
            NSDictionary * jsonData = [md5Code getNSDictionaryData:dictionary];//解析为字典数据
            if ([jsonData[@"code"] isEqualToString:@"000000"]) {
                if ([jsonData[@"body"] count] > 0) {
                    if ([compareMD5Str isEqualToString:signResult]) {
                        NSLog(@"成功");
                        NSDictionary * contentDic = jsonData[@"body"][0];
                        self.projectTitleLab.text = contentDic[@"entitle"];//福乐精选名
                        self.bidNumLab.text = [NSString stringWithFormat:@"投标人数:%@人", contentDic[@"numpe"]];
                        self.lastBidNumContentLab.text = contentDic[@"sursum"];//剩余投标数额
                        self.bidLimitDayContentLab.text = contentDic[@"invtime"];//投标期限天数
                        self.investmentAmountContentLab.text = contentDic[@"invam"];//起投金额数
                        self.objectAmountLab.text = contentDic[@"invesum"];//标的总额
                        self.todayJoinDateLab.text = contentDic[@"time"];//今日加入日期
                        self.nextDayDateLab.text = contentDic[@"next_time"];//次日计息日期
                        self.lockDayDateLab.text = contentDic[@"proEndTime"];//锁定期满日期
                        self.lastAccountDateLab.text = contentDic[@"lastTime"];//最迟到账日期
                        //出借率
                        NSString * lendRateStr = [NSString stringWithFormat:@"%@%",contentDic[@"lolimit"]];
                        NSMutableAttributedString *noteStr = [[NSMutableAttributedString alloc] initWithString:lendRateStr];
                        // 需要改变的第一个文字的位置
                        NSUInteger firstLoc = 0;
                        // 需要改变的最后一个文字的位置
                        NSUInteger secondLoc = [[noteStr string] rangeOfString:@"%"].location;
                        // 需要改变的区间
                        NSRange range = NSMakeRange(firstLoc, secondLoc - firstLoc);
                        [noteStr addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:range];
                        [noteStr addAttribute:NSFontAttributeName value:[UIFont fontWithName:@"Arial-BoldMT" size:26] range:range];
                        [self.lendRateContentLab setAttributedText:noteStr];
                    }else{
                        NSLog(@"失败");
                        ShowMessage(jsonData[@"msg"]);
                    }
                }else{
                    ShowMessage(jsonData[@"msg"]);
                }
            }else{
                ShowMessage(jsonData[@"msg"]);
            }
            
        }
    }];
}

@end
@implementation SiftDetailViewController
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self setStatusBarBackgroundColor:[UIColor blackColor] withAlpha:0.6];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.delegate = self;
    self.view.backgroundColor = [UIColor whiteColor];
    
    if (@available(iOS 11.0, *)) {
        self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }else {
        self.automaticallyAdjustsScrollViewInsets = NO;
    }
    [self.view addSubview:self.tableView];
    [self setNextPageBtn];//跳转按钮
    
    //网络接口
//    [self siftDetailData];
}

- (UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}
#pragma mark - UINavigationControllerDelegate
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {
    BOOL isHomePage = [viewController isKindOfClass:[self class]];
    [self.navigationController setNavigationBarHidden:isHomePage animated:YES];
}
#pragma mark - init
- (UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - BOTTOM_HEIGHT - 55/WIDTH_6_SCALE)];
        _tableView.backgroundColor = [UIColor whiteColor];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.tableHeaderView = self.headerView;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
//        _tableView.rowHeight = 58/WIDTH_6_SCALE;
        [_tableView registerClass:[SiftDetailTableViewCell class] forCellReuseIdentifier:NSStringFromClass([SiftDetailTableViewCell class])];
    }return _tableView;
}

- (UIView *)headerView{
    if (!_headerView) {
        _headerView = [[UIView alloc] init];
        if (Is_Iphone_X) {
            _headerView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 402/WIDTH_6_SCALE + 24 + 24/WIDTH_6_SCALE);
        }else{
            _headerView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 402/WIDTH_6_SCALE + 22/WIDTH_6_SCALE);
        }
        _headerView.backgroundColor = getColor(grayBGColor);
        //蓝色背景
        UIView * bgColorView = [[UIView alloc] init];
        bgColorView.backgroundColor = getColor(@"3675bd");
        [_headerView addSubview:bgColorView];
        //返回按钮
        self.backBtn = [[UIButton alloc] init];
        [bgColorView addSubview:self.backBtn];
        [self.backBtn addTarget:self action:@selector(backBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        [self.backBtn setImage:[UIImage imageNamed:@"outWhite"] forState:UIControlStateNormal];
        //页面标题
        UILabel * pageTitleLab = [[UILabel alloc] init];
        [self label:pageTitleLab withFont:DEF_FontSize_12 withText:@"加入福乐精选" withTextColor:[UIColor whiteColor] withTextAlignment:NSTextAlignmentCenter withView:bgColorView];
        //福乐精选名
        self.projectTitleLab = [[UILabel alloc] init];
        [self label:self.projectTitleLab withFont:DEF_FontSize_12 withText:@"公共WIFI二年062142" withTextColor:[UIColor whiteColor] withTextAlignment:NSTextAlignmentLeft withView:bgColorView];
        //投标人数
        self.bidNumLab = [[UILabel alloc] init];
        [self label:self.bidNumLab withFont:DEF_FontSize_10 withText:@"投标人数:5人" withTextColor:[UIColor whiteColor] withTextAlignment:NSTextAlignmentRight withView:bgColorView];
        //出借率数额
        self.lendRateContentLab = [[UILabel alloc] init];
        [self label:self.lendRateContentLab withFont:DEF_FontSize_10 withText:@"10.0%" withTextColor:[UIColor whiteColor] withTextAlignment:NSTextAlignmentCenter withView:bgColorView];        
        //出借率标题
        UILabel * lendRateTitleLab = [[UILabel alloc] init];
        [self label:lendRateTitleLab withFont:DEF_FontSize_10 withText:@"平台建议平均出借率" withTextColor:getColor(@"9bb4d9") withTextAlignment:NSTextAlignmentCenter withView:bgColorView];
        //蓝色部分分割线
        UIView * blueBGBorderView = [[UIView alloc] init];
        blueBGBorderView.backgroundColor = getColor(@"5485bd");
        [bgColorView addSubview:blueBGBorderView];
        //剩余投资数额
        self.lastBidNumContentLab = [[UILabel alloc] init];
        [self label:self.lastBidNumContentLab withFont:DEF_FontSize_15 withText:@"1,000,000" withTextColor:[UIColor whiteColor] withTextAlignment:NSTextAlignmentCenter withView:bgColorView];
        //剩余投标标题
        UILabel * lastBidTitleLab = [[UILabel alloc] init];
        [self label:lastBidTitleLab withFont:DEF_FontSize_10 withText:@"剩余投标额(元)" withTextColor:getColor(@"90acd5") withTextAlignment:NSTextAlignmentCenter withView:bgColorView];
        //投标期限天数
        self.bidLimitDayContentLab = [[UILabel alloc] init];
        [self label:self.bidLimitDayContentLab withFont:DEF_FontSize_15 withText:@"365" withTextColor:[UIColor whiteColor] withTextAlignment:NSTextAlignmentCenter withView:bgColorView];
        //投标期限标题
        UILabel * bidLimitDayTitleLab = [[UILabel alloc] init];
        [self label:bidLimitDayTitleLab withFont:DEF_FontSize_10 withText:@"投标期限(天)" withTextColor:getColor(@"90acd5") withTextAlignment:NSTextAlignmentCenter withView:bgColorView];
        //起投金额数
        UILabel * investmentAmountTitleLab = [[UILabel alloc] init];
        [self label:investmentAmountTitleLab withFont:DEF_FontSize_10 withText:@"起投金额(元)" withTextColor:getColor(@"90acd5") withTextAlignment:NSTextAlignmentCenter withView:bgColorView];
        //起投金额标题
        self.investmentAmountContentLab = [[UILabel alloc] init];
        [self label:self.investmentAmountContentLab  withFont:DEF_FontSize_15 withText:@"1,000" withTextColor:[UIColor whiteColor] withTextAlignment:NSTextAlignmentCenter withView:bgColorView];
        //上部灰色分割线上
        UIView * upTopLineView = [[UIView alloc] init];
        upTopLineView.backgroundColor = getColor(grayColor);
        [_headerView addSubview:upTopLineView];
        //上部灰色分割线下
        UIView * upBottomLineView = [[UIView alloc] init];
        upBottomLineView.backgroundColor = getColor(grayColor);
        [_headerView addSubview:upBottomLineView];
        //白色背景
        UIView * whiteView = [[UIView alloc] init];
        whiteView.backgroundColor = [UIColor whiteColor];
        [_headerView addSubview:whiteView];
        //标的总额
        self.objectAmountLab = [[UILabel alloc] init];
        [self label:self.objectAmountLab withFont:DEF_FontSize_12 withText:@"标的总额  500万元" withTextColor:[UIColor blackColor] withTextAlignment:NSTextAlignmentCenter withView:whiteView];
        //今日加入
        UILabel * todayJoinTitleLab = [[UILabel alloc] init];
        [self label:todayJoinTitleLab withFont:DEF_FontSize_10 withText:@"今日加入" withTextColor:[UIColor blackColor] withTextAlignment:NSTextAlignmentCenter withView:whiteView];
        //次日计息
        UILabel * nextDayTitleLab = [[UILabel alloc] init];
        [self label:nextDayTitleLab withFont:DEF_FontSize_10 withText:@"次日计息" withTextColor:[UIColor blackColor] withTextAlignment:NSTextAlignmentCenter withView:whiteView];
        //锁定期满
        UILabel * lockDayTitleLab = [[UILabel alloc] init];
        [self label:lockDayTitleLab withFont:DEF_FontSize_10 withText:@"锁定期满" withTextColor:[UIColor blackColor] withTextAlignment:NSTextAlignmentCenter withView:whiteView];
        //最迟到账
        UILabel * lastCountTitleLab = [[UILabel alloc] init];
        [self label:lastCountTitleLab withFont:DEF_FontSize_10 withText:@"最迟到账" withTextColor:[UIColor blackColor] withTextAlignment:NSTextAlignmentCenter withView:whiteView];
        //今日加入红点
        UIView * todayJoinView = [[UIView alloc] init];
        [whiteView addSubview:todayJoinView];
        [self view:todayJoinView withBackground:getColor(@"fbebeb") withBorderColor:getColor(@"f09192") withBorderWidth:1 withCornerRadius:5/WIDTH_6_SCALE withMasksToBounds:YES];
        //次日计息红点
        UIView * nextDayView = [[UIView alloc] init];
        [whiteView addSubview:nextDayView];
        [self view:nextDayView withBackground:getColor(@"fbebeb") withBorderColor:getColor(@"f09192") withBorderWidth:1 withCornerRadius:5/WIDTH_6_SCALE withMasksToBounds:YES];
        //锁定期满红点
        UIView * lockDayView = [[UIView alloc] init];
        [whiteView addSubview:lockDayView];
        [self view:lockDayView withBackground:getColor(@"fbebeb") withBorderColor:getColor(@"f09192") withBorderWidth:1 withCornerRadius:5/WIDTH_6_SCALE withMasksToBounds:YES];
        //最迟到账红点
        UIView * lastCountView = [[UIView alloc] init];
        [whiteView addSubview:lastCountView];
        [self view:lastCountView withBackground:getColor(@"fbebeb") withBorderColor:getColor(@"f09192") withBorderWidth:1 withCornerRadius:5/WIDTH_6_SCALE withMasksToBounds:YES];
        //今日加入日期
        self.todayJoinDateLab = [[UILabel alloc] init];
        [self label:self.todayJoinDateLab withFont:DEF_FontSize_10 withText:@"2018-01-01" withTextColor:getColor(@"737373") withTextAlignment:NSTextAlignmentCenter withView:whiteView];
        //次日计息日期
        self.nextDayDateLab = [[UILabel alloc] init];
        [self label:self.nextDayDateLab withFont:DEF_FontSize_10 withText:@"2018-01-01" withTextColor:getColor(@"737373") withTextAlignment:NSTextAlignmentCenter withView:whiteView];
        //锁定期满日期
        self.lockDayDateLab = [[UILabel alloc] init];
        [self label:self.lockDayDateLab withFont:DEF_FontSize_10 withText:@"2018-01-01" withTextColor:getColor(@"737373") withTextAlignment:NSTextAlignmentCenter withView:whiteView];
        //最迟到账日期
        self.lastAccountDateLab = [[UILabel alloc] init];
        [self label:self.lastAccountDateLab withFont:DEF_FontSize_10 withText:@"2018-01-01" withTextColor:getColor(@"737373") withTextAlignment:NSTextAlignmentCenter withView:whiteView];
        //下部灰色分割线上
        UIView * downTopLineView = [[UIView alloc] init];
        downTopLineView.backgroundColor = getColor(grayColor);
        [_headerView addSubview:downTopLineView];
        //下部灰色分割线下
        UIView * downBottomLineView = [[UIView alloc] init];
        downBottomLineView.backgroundColor = getColor(grayColor);
        [_headerView addSubview:downBottomLineView];
        //今日和次日之间红线
        UIView * leftLineView = [[UIView alloc] init];
        leftLineView.backgroundColor = getColor(@"f09192");
        [whiteView addSubview:leftLineView];
        //次日和锁定之间红线
        UIView * middleLineView = [[UIView alloc] init];
        middleLineView.backgroundColor = getColor(@"f09192");
        [whiteView addSubview:middleLineView];
        //锁定和最迟之间红线
        UIView * rightLineView = [[UIView alloc] init];
        rightLineView.backgroundColor = getColor(@"f09192");
        [whiteView addSubview:rightLineView];
        //masonry
        __weak typeof (self)weakSelf = self;
        if (Is_Iphone_X) {
            [bgColorView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.left.right.equalTo(weakSelf.headerView);
                make.height.mas_offset(254/WIDTH_6_SCALE + 44);
            }];
            [self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(weakSelf.headerView.mas_left).mas_offset(18/WIDTH_6_SCALE);
                make.top.equalTo(weakSelf.headerView.mas_top).mas_offset((15 + 44)/WIDTH_6_SCALE);
                make.width.mas_offset(backButtonW);
                make.height.mas_offset(backButtonH);
            }];
            [self.projectTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(weakSelf.headerView.mas_left).mas_offset(18/WIDTH_6_SCALE);
                make.top.equalTo(weakSelf.headerView.mas_top).mas_offset((15+44+22)/WIDTH_6_SCALE + backButtonH);
                make.height.mas_offset(12/WIDTH_6_SCALE);
            }];
        }else{
            [bgColorView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.top.left.right.equalTo(weakSelf.headerView);
                make.height.mas_offset(254/WIDTH_6_SCALE + 20);
            }];
            [self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(weakSelf.headerView.mas_left).mas_offset(18/WIDTH_6_SCALE);
                make.top.equalTo(weakSelf.headerView.mas_top).mas_offset((15 + 20)/WIDTH_6_SCALE);
                make.width.mas_offset(backButtonW);
                make.height.mas_offset(backButtonH);
            }];
            [self.projectTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(weakSelf.headerView.mas_left).mas_offset(18/WIDTH_6_SCALE);
                make.top.equalTo(weakSelf.headerView.mas_top).mas_offset((15+20+22)/WIDTH_6_SCALE + backButtonH);
                make.height.mas_offset(12/WIDTH_6_SCALE);
            }];
        }
        [pageTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(weakSelf.backBtn.mas_centerY);
            make.width.mas_offset(SCREEN_WIDTH);
            make.height.mas_offset(15/WIDTH_6_SCALE);
        }];
        [self.bidNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(weakSelf.projectTitleLab.mas_centerY);
            make.right.equalTo(weakSelf.headerView.mas_right).mas_offset(-16/WIDTH_6_SCALE);
        }];
        [self.lendRateContentLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakSelf.projectTitleLab.mas_bottom).mas_offset(28/WIDTH_6_SCALE);
            make.centerX.equalTo(weakSelf.headerView.mas_centerX);
            make.height.mas_offset(28/WIDTH_6_SCALE);
        }];
        [lendRateTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakSelf.lendRateContentLab.mas_bottom).mas_offset(10/WIDTH_6_SCALE);
            make.centerX.equalTo(weakSelf.headerView.mas_centerX);
            make.height.mas_offset(10/WIDTH_6_SCALE);
        }];
        [blueBGBorderView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(lendRateTitleLab.mas_bottom).mas_offset(29/WIDTH_6_SCALE);
            make.left.equalTo(weakSelf.headerView.mas_left).mas_offset(23/WIDTH_6_SCALE);
            make.right.equalTo(weakSelf.headerView.mas_right).mas_offset(-23/WIDTH_6_SCALE);
            make.height.mas_offset(1/WIDTH_6_SCALE);
        }];
        [self.lastBidNumContentLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.headerView.mas_left);
            make.width.mas_offset(SCREEN_WIDTH/3);
            make.top.equalTo(blueBGBorderView.mas_bottom).mas_offset(13/WIDTH_6_SCALE);
            make.height.mas_offset(16/WIDTH_6_SCALE);
        }];
        [lastBidTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.headerView);
            make.width.equalTo(weakSelf.lastBidNumContentLab);
            make.top.equalTo(weakSelf.lastBidNumContentLab.mas_bottom).mas_offset(11/WIDTH_6_SCALE);
        }];
        [self.bidLimitDayContentLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.lastBidNumContentLab.mas_right);
            make.width.top.height.equalTo(weakSelf.lastBidNumContentLab);
        }];
        [bidLimitDayTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(lastBidTitleLab.mas_right);
            make.top.height.width.equalTo(lastBidTitleLab);
        }];
        [self.investmentAmountContentLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.bidLimitDayContentLab.mas_right);
            make.width.top.height.equalTo(weakSelf.bidLimitDayContentLab);
        }];
        [investmentAmountTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(bidLimitDayTitleLab.mas_right);
            make.top.height.width.equalTo(lastBidTitleLab);
        }];
        [upTopLineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(weakSelf.headerView);
            make.height.mas_offset(1/WIDTH_6_SCALE);
            make.top.equalTo(bgColorView.mas_bottom).mas_offset(0/WIDTH_6_SCALE);
        }];
        [upBottomLineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(weakSelf.headerView);
            make.height.mas_offset(1/WIDTH_6_SCALE);
            make.top.equalTo(upTopLineView.mas_bottom).mas_offset(13/WIDTH_6_SCALE);
        }];
        [whiteView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(weakSelf.headerView);
            make.top.equalTo(upBottomLineView.mas_bottom);
            make.bottom.equalTo(downTopLineView.mas_top);
        }];
        [self.objectAmountLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(whiteView.mas_top).mas_offset(16/WIDTH_6_SCALE);
            make.left.equalTo(weakSelf.headerView.mas_left).mas_offset(18/WIDTH_6_SCALE);
            make.height.mas_offset(12/WIDTH_6_SCALE);
        }];
        
        NSArray * dataTitleArr = @[todayJoinTitleLab, nextDayTitleLab, lockDayTitleLab, lastCountTitleLab];
        [dataTitleArr mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedItemLength:50/WIDTH_6_SCALE leadSpacing:18/WIDTH_6_SCALE tailSpacing:18/WIDTH_6_SCALE];
        [dataTitleArr mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakSelf.objectAmountLab.mas_bottom).mas_offset(27/WIDTH_6_SCALE);
            make.height.mas_offset(10/WIDTH_6_SCALE);
        }];
        [todayJoinView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(todayJoinTitleLab.mas_bottom).mas_offset(9/WIDTH_6_SCALE);
            make.height.width.mas_offset(10/WIDTH_6_SCALE);
            make.left.equalTo(weakSelf.headerView.mas_left).mas_offset(18/WIDTH_6_SCALE);
        }];
        [nextDayView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(nextDayTitleLab.mas_centerX);
            make.top.width.height.equalTo(todayJoinView);
        }];
        [lockDayView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(lockDayTitleLab.mas_centerX);
            make.top.width.height.equalTo(todayJoinView);
        }];
        [lastCountView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(lastCountTitleLab.mas_right);
            make.top.width.height.equalTo(todayJoinView);
        }];
        [leftLineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(todayJoinView.mas_right).mas_offset(5/WIDTH_6_SCALE);
            make.centerY.equalTo(todayJoinView.mas_centerY);
            make.right.equalTo(nextDayView.mas_left).mas_offset(-5/WIDTH_6_SCALE);
            make.height.mas_offset(1/WIDTH_6_SCALE);
        }];
        [middleLineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(nextDayView.mas_right).mas_offset(5/WIDTH_6_SCALE);
            make.centerY.equalTo(todayJoinView.mas_centerY);
            make.right.equalTo(lockDayView.mas_left).mas_offset(-5/WIDTH_6_SCALE);
            make.height.equalTo(leftLineView);
        }];
        [rightLineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(lockDayView.mas_right).mas_offset(5/WIDTH_6_SCALE);
            make.centerY.equalTo(todayJoinView.mas_centerY);
            make.right.equalTo(lastCountView.mas_left).mas_offset(-5/WIDTH_6_SCALE);
            make.height.equalTo(leftLineView);
        }];
        [self.todayJoinDateLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(todayJoinTitleLab.mas_centerX);
            make.top.equalTo(todayJoinView.mas_bottom).mas_offset(9/WIDTH_6_SCALE);
            make.height.mas_offset(9/WIDTH_6_SCALE);
        }];
        [self.nextDayDateLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.top.width.equalTo(self.todayJoinDateLab);
            make.centerX.equalTo(nextDayTitleLab.mas_centerX);
        }];
        [self.lockDayDateLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.top.width.equalTo(self.todayJoinDateLab);
            make.centerX.equalTo(lockDayTitleLab.mas_centerX);
        }];
        [self.lastAccountDateLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.top.width.equalTo(self.todayJoinDateLab);
            make.centerX.equalTo(lastCountTitleLab.mas_centerX);
        }];
        [downTopLineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(weakSelf.headerView);
            make.top.equalTo(weakSelf.todayJoinDateLab.mas_bottom).mas_offset(20/WIDTH_6_SCALE);
            make.height.mas_offset(1/WIDTH_6_SCALE);
        }];
        [downBottomLineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(weakSelf.headerView);
            make.top.equalTo(downTopLineView.mas_bottom).mas_offset(13/WIDTH_6_SCALE);
            make.height.mas_offset(1/WIDTH_6_SCALE);
        }];
        [_headerView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.mas_offset(SCREEN_WIDTH);
            make.bottom.equalTo(downBottomLineView.mas_bottom);
        }];
    }return _headerView;
}
- (void)setNextPageBtn{
    self.joinBtn = [[UIButton alloc] init];
    self.joinBtn.titleLabel.font = DEF_FontSize_14;
    [self.joinBtn setTitle:@"立即加入" forState:UIControlStateNormal];
    [self.joinBtn setBackgroundColor:[UIColor orangeColor]];
    [self.joinBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.joinBtn addTarget:self action:@selector(joinBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.joinBtn];
    [self.joinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.view);
        make.height.mas_offset(55/WIDTH_6_SCALE);
        make.top.equalTo(self.view.mas_bottom).mas_offset(-55/WIDTH_6_SCALE - BOTTOM_HEIGHT);
    }];
}

- (NSMutableArray *)cellContentArr{
    if (!_cellContentArr) {
        _cellContentArr = @[@{@"title":@"产品介绍", @"img":@"chanpinjieshao"},
                            @{@"title":@"借款资料", @"img":@"jiekuanziliao"},
                            @{@"title":@"风控资料", @"img":@"fengkongziliao"},
                            @{@"title":@"出借记录", @"img":@"touzijilu"},
                            @{@"title":@"常见问题", @"img":@"changjianwenti"}].mutableCopy;
    }return _cellContentArr;
}
#pragma mark - action
- (void)joinBtnClick:(UIButton *)sender{
    JoinSiftViewController * joinSiftVC = [[JoinSiftViewController alloc] init];
    joinSiftVC.bidID = self.bidID;
    [self.navigationController pushViewController:joinSiftVC animated:YES];
}
- (void)backBtnClick:(UIButton *)sender{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - method
- (void)view:(UIView *)view withBackground:(UIColor *)bgColor withBorderColor:(UIColor *)borderColor withBorderWidth:(CGFloat)borderWidth withCornerRadius:(CGFloat)cornerRadius withMasksToBounds:(BOOL)masksToBounds{
    view.backgroundColor = bgColor;
    view.layer.borderColor = borderColor.CGColor;
    view.layer.borderWidth = borderWidth;
    view.layer.cornerRadius = cornerRadius;
    view.layer.masksToBounds = masksToBounds;
}
#pragma mark - tableViewDelegate和tableViewDataSource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    SiftDetailTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([SiftDetailTableViewCell class]) forIndexPath:indexPath];
    cell.model = self.cellContentArr[indexPath.row];
    return cell;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.cellContentArr.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 58/WIDTH_6_SCALE;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 3) {
        LendRecordViewController * vc = [[LendRecordViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
}
@end
